#!/usr/bin/env python
import os
import sys
from subprocess import STDOUT, check_output

assert sys.version_info[:2] == (3, 10), sys.version


def sh(cmd, **kwargs):
    return check_output(cmd, **kwargs).decode("utf8").strip()


kernel_python = os.path.join(os.environ["KERNEL_PYTHON_PREFIX"], "bin", "python")
out = sh([kernel_python, "--version"], stderr=STDOUT)
v = out.split()[1]
assert v[:3] == "3.5", out

out = sh(["micromamba", "--version"])
assert out == "2.3.3", out

out = sh(["mamba", "--version"])
assert out == "2.3.3", out


sh([kernel_python, "-c", "import numpy"])
